# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>
# Contributor: kaylyn
# Contributor: Giuseppe Calà <jiveaxe@gmail.com>

pkgname=cryfs
pkgver=0.11.3
pkgrel=3
pkgdesc='Cryptographic filesystem for the cloud'
arch=(loong64 x86_64)
depends=(fuse2 curl spdlog fmt boost-libs)
makedepends=(cmake python boost range-v3)
url='https://www.cryfs.org'
license=(LGPL3)
source=(https://github.com/cryfs/cryfs/releases/download/$pkgver/cryfs-$pkgver.tar.xz{,.asc})
sha256sums=('18f68e0defdcb7985f4add17cc199b6653d5f2abc6c4d237a0d48ae91a6c81c0'
            'SKIP')
validpgpkeys=(5D5EC7BC6F1443EC2AF7177A9E6C996C991D25E1) # CryFS Team <messmer@cryfs.org>

prepare() {
  sed -e '/Release/d' -i doc/CMakeLists.txt # Install man page also with dafault build type
}

build() {
  cmake -B build -S . \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTING=OFF \
    -DCRYFS_UPDATE_CHECKS=OFF \
    -DDEPENDENCY_CONFIG="cmake-utils/DependenciesFromLocalSystem.cmake"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  install -Dm 644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname
  install -Dm 644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
}
